/******************************************************************************
Copyright (c) 2009,Corparation Name Co.,Ltd. All rights reserved.
******************************************************************************/
/** @file
 * @brief declarations of functions, data structures
 * Project Name:stdlibpatch
 * <br>
 * @author soulmachine@gmail.com
 * @date 2009/03/27
 * @version 0.1
 * @note none
 * @remarks none
 */
#ifndef _STDLIBPATCH_H_
#define _STDLIBPATCH_H_

//#ifdef __cplusplus
//extern "C"{
//#endif



#include <stdlib.h>

void * __cdecl mallocex(size_t size);

/** @brief singly linked list */
typedef struct slist_t slist_t;

/**
* @brief initialise the list
* @param[in] slist the list
* @param[in] elem_size size of a element, just pass sizeof(elem_type) to it
* @return none
* @note none
* @remarks none
*/
void slist_construct(slist_t* slist, size_t elem_size);

/**
* @brief return the head of list
* @param[in] slist the list
* @return the head of the list
* @note none
* @remarks none
*/
void *slist_head(slist_t* slist);

/**
* @brief return the next element of current element
* @param[in] slist the list
* @param[in] elem current element
* @return next element
* @note none
* @remarks none
*/
void *slist_next(slist_t* slist, void* elem);

/**
* @brief insert a element after the current element
* @param[in] slist the list
* @param[in] elem the element which elem_to_be_inserted is bo be inserted after
* @param[in] elem_to_be_inserted element to be inserted
* @return pointer to the inserted element
* @note none
* @remarks none
*/
void *slist_insert(slist_t* slist, void* elem, const void *elem_to_be_inserted);

/**
* @brief insert a element at the tail of list
* @param[in] slist the list
* @param[in] elem element to be inserted
* @return pointer to the inserted element
* @note none
* @remarks none
*/
void *slist_push_back(slist_t* slist, const void *elem);

/**
* @brief destruct the list
* @param[in] slist the list to be destructed
* @return none
* @note none
* @remarks none
*/
void slist_destruct(slist_t* slist);


/** @brief variable tree */
typedef struct variable_tree_t variable_tree_t;



//#ifdef __cplusplus
//}
//#endif

#endif /* end of _STDLIBPATCH_H_ */
